package io.mya.modules.sys.controller;

import io.mya.modules.sys.service.UserGeneralizeService;
import io.mya.modules.sys.vo.PrometorUserZTree;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class UserGeneralizeController {
    @Autowired
    UserGeneralizeService userGeneralize;

    @RequestMapping("/t")
    @ResponseBody
    public String t() {
        userGeneralize.getSubUser(2);
        return "success";
    }

    @RequestMapping("/generalize/{id}")
    public String generalize(@PathVariable("id")Long id){
        return "/regist";
    }

    @RequestMapping("/prometor/{id}")
    @ResponseBody
    public PrometorUserZTree prometor(@PathVariable("id") Long id){
        return userGeneralize.getUser(id);
    }
    @RequestMapping("/prometor/p/{id}")
    @ResponseBody
    public List<PrometorUserZTree> prometorP(@PathVariable("id") Long id){
        return userGeneralize.getSubUser(id);
    }
}
